import { ToastActionType } from '../actions/toastAction'

const toast_state = {
  show: false,
  text: ''
}
const ToastState = (state = toast_state, action) => {
  switch (action.type) {
    case ToastActionType.hide_toast:
      return Object.assign({}, state, {
        show: false,
        text: ''
      })
    case ToastActionType.show_toast:
      return Object.assign({}, state, {
        show: true,
        text: action.text
      })
    default:
      return state
  }
}
ToastState._default_state = toast_state
export default ToastState
